﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace project_soft.PL
{
    public partial class LogIn : Form
    {
        public LogIn()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BL.Employee emp = new BL.Employee();
            emp.User_Name1 = textBox1.Text;
            emp.User_Password1 = textBox2.Text;
            if (emp.logIn(emp.User_Name1,emp.User_Password1))
            {
                if (emp.User_Type1 == 1)
                {
                    this.Hide();
                    new PL.ManagerForm().ShowDialog();
                }
                else {
                    this.Hide();
                    new PL.WorkerForm().ShowDialog();
                }
            }
            else {
                MessageBox.Show("يوجد خطا فى اسم المستخدم او كلمة المرور");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            Close();
        }
    }
}
